package org.mosquitos.chat;

import java.io.IOException;

import net.jxta.endpoint.Message;
import net.jxta.endpoint.MessageElement;
import net.jxta.peergroup.PeerGroup;
import net.jxta.pipe.InputPipe;
import net.jxta.pipe.PipeMsgEvent;
import net.jxta.pipe.PipeMsgListener;
import net.jxta.pipe.PipeService;

import org.mosquitos.chat.PipeSendService;

public class PipeReciveListener implements PipeMsgListener {

	public void pipeMsgEvent(PipeMsgEvent pipeMsgEvent) {
		Message message = pipeMsgEvent.getMessage();
		if(message.getMessageElements().hasNext()){
			MessageElement messageElement = message.getMessageElement(null, PipeSendService.MESSAGE_NAME_SPACE);
			System.out.println(messageElement);
		}
	}

}
